class SceneManager extends egret.Sprite{

	// 开始场景
	private beginScene: BeginScene;
	// 游戏场景
	private gameScene: GameScene;

	// 场景控制单例
	private static shared: SceneManager;

	// 实例化单例获取方法
	public static Shared(): SceneManager {
		if(!SceneManager.shared) {
			SceneManager.shared = new SceneManager();
		}
		return SceneManager.shared;
	}

	
	public constructor() {
		super();
		this.init();
	}


	/**
	 * 初始化
	 */
	private init() {
		// 实例化两个场景
		this.beginScene = new BeginScene();
		this.gameScene = new GameScene();

		// 默认添加开始场景
		this.addChild(this.beginScene);

	}

	// 切换场景
	public changeScene(type) {
		if(type == 'gameScene') {
			this.beginScene.release();
		}
		// 移除所有显示列表中的对象
		this.removeChildren();
		// 添加下一个场景
		this.addChild(this.gameScene);
	}
}